package com.demo.thread.rejectPolicy;

import java.util.UUID;
import java.util.concurrent.*;

/**
 * CallerRunsPolicy 主线程会阻塞直接运行这个run线程
 * 86e85e35-2b91-4063-a819-bf4df26553ea
 */
public class CallerRunsPolicyTest {
    public static void main(String[] args) {
        String file = "23,";
        String file2 = file.replaceAll(",","");
        System.out.println("file2:"+file2);
        int random = (int)((Math.random()*9+1)*100000);
        String jessionId = UUID.randomUUID().toString().replace("-","");
        String gsoId = UUID.randomUUID().toString();
        System.out.println("uuid:"+jessionId);
        System.out.println("gsoId:"+gsoId);
        System.out.println("random:"+random);

//        BlockingQueue<Runnable> queue = new ArrayBlockingQueue<Runnable>(3);
//        RejectedExecutionHandler handler = new ThreadPoolExecutor.CallerRunsPolicy();
//        ThreadPoolExecutor pool = new ThreadPoolExecutor(3, 3, 0, TimeUnit.SECONDS, queue, handler);
//        for (int i = 0; i < 20; i ++){
//            final int temp = i;
//            pool.execute(() -> {
//                System.out.println(Thread.currentThread().getName()+",客户" + temp + "来了.......");
//                try {
//                    Thread.sleep(10);
//                } catch (InterruptedException e) {
//                    e.printStackTrace();
//                }
//                System.out.println(Thread.currentThread().getName()+",客户" + temp + "完成结束");
//            });
//        }
//        System.out.println("<<<<<<<<<<finish");
//        pool.shutdown();
    }
}
